package presentation.entities;

import businessEntities.QueryResultContainer;
import javax.swing.table.AbstractTableModel;

/**
 * Table Model for representing Database table data inside JTable object
 */
public class QueryTableModel extends AbstractTableModel {

    QueryResultContainer dataContainer;

    public QueryTableModel(QueryResultContainer dataContainer) {
        this.dataContainer = dataContainer;
    }

    @Override
    public int getRowCount() {
        return dataContainer.getRowCount();
    }

    @Override
    public int getColumnCount() {
        return dataContainer.getColumnCount();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return dataContainer.getDataAt(rowIndex, columnIndex);
    }

    @Override
    public String getColumnName(int column) {
        return dataContainer.getColumnAt(column);
    }
}
